import {
    createRouter,
    createWebHistory,
    createWebHashHistory,
} from "vue-router";

const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: "/",
            redirect: "/BasicLayout",
        },
        {
            path: "/login",
            name: "login",
            meta: {
                title: "用户登录",
            },
            component: () => import("@/pages/Login/index.vue"),
        },
        {
            path: "/three",
            name: "Three",
            meta: {
                title: "three.js",
            },
            component: () => import("@/pages/Three/index.vue"),
        },
        {
            path: "/404",
            name: "404",
            meta: {
                title: "找不到页面",
            },
            component: () => import("@/common/pages/ErrorPage/index.vue"),
        },
        {
            path: "/redirect",
            component: () => import("@/layouts/BasicLayout/index.vue"),
            hidden: true,
            children: [
                {
                    meta: {
                        isRedirect: true,
                    },
                    path: "/redirect/:path(.*)",
                    component: () => import("@/common/pages/Redirect/index.vue"),
                },
            ],
        },
    ],
});

export default router;
